<me:UITMKRF
    x:Class="WPFExcelReport.TAV33SPLIT"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
     xmlns:Localization="clr-namespace:Localization;assembly=Localization"
     xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"
     xmlns:me="clr-namespace:WPFExcelReport"
     xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
    x:Name="TV"
    Loaded="Window_Loaded"
 >
    <me:UITMKRF.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:PNumConverter x:Key="pnum"/>
        <ucd:Divideby1440  x:Key="day"/>
        <ucd:Divideby480  x:Key="shift"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UITMKRF.Resources>
    <Grid IsEnabled="{Binding IsBusy,ElementName=TV,Converter={StaticResource not}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <WrapPanel Grid.Row="0" >
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Button Grid.Column="0"  Width="20" Height="20"   Margin="10,0,0,0"  Click="LoadMKRF">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/download.png" />
                    </Button.Background>
                </Button>
                <TextBlock Grid.Column="1"  VerticalAlignment="Center" Text="{Binding Source={Localization:TranslateExtension Word=载入}}"></TextBlock>
            </Grid>
            <Button Margin="20,0,0,0"  VerticalAlignment="Center" Content="{Binding Source={Localization:Translate Word=自动拆分所有}}"   Width="Auto" Click="SplitAllCommand"/>
            <TextBlock   Width="Auto"  Margin="20,0,0,0" Text="{Binding Source={Localization:Translate Word=生产批次}}" />
            <ex:TXT72    MaxLength="2"  Background="White"  Width="30"   CharacterCasing="Upper" Margin="5,0,0,0" Text="{Binding KRS,ElementName=TV}" />
            <ex:TXT72  MaxLength="6" Background="White"  Width="80"   Margin="5,0,0,0" Text="{Binding LFD,ElementName=TV}"/>
            <ex:TXT72  MaxLength="3"  Background="White"  Width="40"    Margin="5,0,0,0" Text="{Binding POS,ElementName=TV}" />
            <TextBlock  Background="White"  Width="40" Text="{Binding Path=MKFTP,Converter={StaticResource ResourceKey=pnum},Source={StaticResource vwMaster}}" Margin="5,0,0,0"  />
            <Button Content="{Binding Source={Localization:Translate Word=筛选}}"   Margin="10,0,0,0" Width="Auto" Click="btnJobFilter_Click"/>
            <Button Content="{Binding Source={Localization:Translate Word=显示所有}}"   Margin="10,0,0,0" Width="Auto" Click="btnShowAllJob_Click"/>
            <TextBlock   Width="Auto"  Margin="10,0,0,0" Text="{Binding Source={Localization:Translate Word=数量:}}" VerticalAlignment="Center" />
            <TextBlock VerticalAlignment="Center" Background="White"  Width="40" Text="{Binding Path=MKFSMG5,Converter={StaticResource ResourceKey=d100},Source={StaticResource vwMaster}}" Margin="5,0,0,0"  />
            <TextBlock   Width="Auto"  Margin="10,0,0,0" Text="{Binding Source={Localization:Translate Word=机台数:}}" VerticalAlignment="Center" />
            <TextBlock VerticalAlignment="Center" Background="White"  Width="40" Text="{Binding Path=JP08,Source={StaticResource vwMaster}}" Margin="5,0,0,0"  />
            <TextBlock   Width="Auto"  Margin="10,0,0,0" Text="{Binding Source={Localization:Translate Word=分批量:}}" VerticalAlignment="Center" />
            <TextBox  VerticalAlignment="Center" Background="White"  Width="40" Text="{Binding SQTY,Converter={StaticResource d100},ElementName=TV}"  Margin="5,0,0,0"   />
            <Button VerticalAlignment="Center" Content="{Binding Source={Localization:Translate Word=拆分}}"   Margin="10,0,0,0" Width="Auto" Click="SplitJobCommand"/>
            <TextBlock   Width="Auto"  Margin="0,0,0,0" Text="{Binding Source={Localization:Translate Word=若勾选，则删除所有已经拆分的任务，慎用}}" />
            <CheckBox IsChecked="{Binding IsRestart,ElementName=TV}"></CheckBox>
        </WrapPanel>
        <DataGrid  Grid.Row="1" CanUserReorderColumns="True"  
                          FontSize="12"
                          CanUserResizeRows="True" CanUserSortColumns="True"                  
                          AutoGenerateColumns="False"   
                          EnableRowVirtualization="True"  
                          RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                          IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                          ItemsSource="{Binding Source={StaticResource vwMaster}}"  
                           x:Name="dlgMaster" 
                  >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=JOBTYPE}" Header="{Binding Source={Localization:TranslateExtension Word=类型}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ABPFARBE}" Header="{Binding Source={Localization:TranslateExtension Word=色号}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ABFAUFKRS}" Header=" "  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ABFAUFLFD, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:TranslateExtension Word=生产单}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ABFAUFPOS, Converter={StaticResource ResourceKey=pnum}}" Header=" "  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=MKFTP, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:TranslateExtension Word=分批}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ABFMNRKRS}" Header=" "  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=ABFMLFDNR}" Header="{Binding Source={Localization:TranslateExtension Word=加工}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=MKFSMG5}" Header="{Binding Source={Localization:TranslateExtension Word=重量}}" Visibility="Collapsed" Width="Auto" />
                <DataGridTextColumn FontSize="14" Foreground="Red" Binding="{Binding Path=ABFBNRKRS}" Header=" "  Width="Auto" />
                <DataGridTextColumn FontSize="14" Foreground="Red" Binding="{Binding Path=ABFBLFDNR, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:TranslateExtension Word=排产}}"  Width="Auto" />
                <DataGridTextColumn FontSize="14" Foreground="Red"  Binding="{Binding Path=ABFBPOS, Converter={StaticResource ResourceKey=pnum}}" Header=" "  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=JP01}" Header="{Binding Source={Localization:TranslateExtension Word=纱支}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=JP04}" Header="{Binding Source={Localization:TranslateExtension Word=产品组}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=JP05}" Header="{Binding Source={Localization:TranslateExtension Word=批量}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=JP08}" Header="{Binding Source={Localization:TranslateExtension Word=机台数}}"  Width="Auto" />
            </DataGrid.Columns>
        </DataGrid  >
        <me:TAVAFKS Grid.Row="2" x:Name="cAV"
                    Visibility="Collapsed"
                    KSTKRS="{Binding KSTKRS,ElementName=TV}" 
                    KST="{Binding KST,ElementName=TV}" 
                    AGANG="{Binding AGANG,ElementName=TV}"
                    AMTYP="{Binding AMTYP,ElementName=TV}"
                    />
    </Grid>
</me:UITMKRF>
